// dnSpy decompiler from Assembly-CSharp.dll class: RandomObjectSpawner
using System;
using System.Collections;
using UnityEngine;

public class RandomObjectSpawner : CheckedMonoBehaviour
{
	private void Start()
	{
		base.StartCoroutine(this.RunLifetime());
	}

	private IEnumerator RunLifetime()
	{
		for (int i = 0; i < this.numToSpawn; i++)
		{
			this.SpawnObjectAtRandomPlace();
			yield return new WaitForSeconds(UnityEngine.Random.Range(this.minDelaySecBtwSpawns, this.maxDelaySecBtwSpawns));
		}
		UnityEngine.Object.Destroy(base.gameObject);
		yield break;
	}

	private void SpawnObjectAtRandomPlace()
	{
		float num = UnityEngine.Random.Range(-this.maxRangeFromCenter, this.maxRangeFromCenter);
		float num2 = UnityEngine.Random.Range(-this.maxRangeFromCenter, this.maxRangeFromCenter);
		Vector3 position = new Vector3(base.transform.position.x + num, base.transform.position.y + num2, base.transform.position.z);
		UnityEngine.Object.Instantiate<GameObject>(this.prefabWhatToSpawn, position, Quaternion.identity);
	}

	public GameObject prefabWhatToSpawn;

	public float minDelaySecBtwSpawns = 0.1f;

	public float maxDelaySecBtwSpawns = 0.25f;

	public int numToSpawn = 8;

	public float maxRangeFromCenter = 0.5f;
}
